﻿/// <reference path="../common/_references.js" />
var pageVerify = {
    initFn: function () {
        var that = this;
    },
    verifyMobile: function (mobile) {
        var ss = mobile;
        var re;
        re = /^0?(13[0-9]|15[012356789]|18[0236789]|14[57])[0-9]{8}$/;
        if (!re.test(ss)) {
            return false;
        }
        return true;
    },
    verifyEmail: function (mail) {
        var ss = mail;
        var re = /^([a-z0-9][a-z0-9_\-\.]*)@([a-z0-9][a-z0-9\.\-]{0,20})\.([a-z]{2,4})$/;
        if (!re.test(ss)) {
             return false;
        }
        return true;
    },            
    verifyPwd: function (pwd1, pwd2) {
         if(pwd1==""){
            return "密码不能为空";
        }
        if(pwd2==""){
            return "确认密码不能为空";
        }
        if(pwd1!=pwd2){
            return "密码不一致";
        }
        var re=/^(?=.*?[a-z])(?=.*?[A-Z])(?=.*?\d)(?=.*?[#@*&.])[a-zA-Z\d#@*&.]{6,20}$/;
        if(!re.test(pwd1)){
          return "密码需要由6～20位字母数字组成";
        }                 
        return true;
    },
    exits: function (url, param,callback,failback) {
        $.post(url, param, function (data) {
            if (data) {
                callback();
            } else {
                failback();
            }
        }, "json");
    }
};